<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>四则运算</title>
		<script type="text/javascript">
			function clac(hao){
			var num1=prompt("请输入第一个数：");
			var hao=prompt("请输入运算符：","+-*/");
			var num2=prompt("请输入第二个数：");
			
			var result;
			num1=parseFloat(num1);
			num2=parseFloat(num2);
			switch(hao){
				case "+":
				result=num1+num2;
				break;
				case "-":
				result=num1-num2;
				break;
				case "*":
				result=num1*num2;
				break;
				case "/":
				result=num1/num2;
				break;
				default:
				alert("您输入不是四则运算的符号");
			}
			alert("运算结果是："+num1+hao+num2+"="+result)
			}
		</script>
	</head>
	<body>
		
		<input type="button"  value="计算器" onclick="clac()"/>
	</body>
</html>
